using System;
using System.Collections.Generic;
using Drill.Core;

namespace Drill.Configuration
{
	public class ConfigurationHelperFactory : IConfigurationHelperFactory
	{
		public IConfigurationHelper CreateConfigurationHelper(IRootPathProvider rootPathProvider, IList<ISearchPath> searchPaths = null)
		{
			if (null == rootPathProvider)
			{
				throw new ArgumentNullException("rootPathProvider");
			}
			IList<IRootPathProvider> rootPathProviders = new List<IRootPathProvider>{rootPathProvider};
			return CreateConfigurationHelper(rootPathProviders, searchPaths);
		}

		public IConfigurationHelper CreateConfigurationHelper(IList<IRootPathProvider> rootPathProviders, IList<ISearchPath> searchPaths = null)
		{
			if (null == rootPathProviders)
			{
				throw new ArgumentNullException("rootPathProviders");
			}
			if (rootPathProviders.Count < 1)
			{
				throw new ArgumentException("The rootPathProviders list is empty but it must contain at least one item.", "rootPathProviders");
			}
			return new ConfigurationHelper(rootPathProviders, searchPaths);
		}
	}
}